package eteam.aps.gateway.config;

import eteam.aps.gateway.common.GatewayPropertyFactory;
import eteam.aps.gateway.model.TestParamDto;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 此方法读取配置文件，可以读取List，Map
 */
@Data
@Component
@PropertySource(value = {"classpath:modules.yml"}, encoding = "utf-8", factory = GatewayPropertyFactory.class)
@ConfigurationProperties(prefix = "test-param1")
public class TestParamProperty {
    //@Value("${test-param1.param1}")
    private String param1;
    //@Value("${test-param1.param2}")
    private List<Integer> param2 = new ArrayList<>();
    //@Value("${test-param1.param3}")
    private List<TestParamDto> param3 = new ArrayList<>();
    //@Value("${test-param1.param4}")
    private List<Map<String, Integer>> param4 = new ArrayList<>();

    public String getParam1() {
        return param1;
    }

    public List<Integer> getParam2() {
        return param2;
    }

    public List<TestParamDto> getParam3() {
        return param3;
    }

    public List<Map<String, Integer>> getParam4() {
        return param4;
    }
}